package nccloud.web.arap.amortization.action;

import java.util.Map;

import nc.vo.arap.amortization.AggAmortizationVO;
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
import nccloud.dto.mmbd.script.entity.BDScriptResultDTO;
import nccloud.web.arap.amortization.utils.ResultUtil;
import nccloud.web.arap.amortization.action.base.BaseScriptAction;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.pubitf.mmbd.commit.service.IBatchRunScript;
import nccloud.pubitf.riart.pflow.CloudPFlowContext;
import nc.bs.framework.common.NCLocator;


public class UnCommitAction extends BaseScriptAction {
        
        @Override
        public Map<String, Object> processSuccessResult(AbstractBill[] bills, AbstractBill[] orginalBills) {
                return ResultUtil.getResult(bills, orginalBills);
        }

        @Override
        public BDScriptResultDTO execScript(AbstractBill[] bills) {
                BDScriptResultDTO result = null;

                try {
                        CloudPFlowContext context = new CloudPFlowContext();
                        context.setActionName("UNSAVE");
                        context.setBillType("TXDJ");
                        context.setBillVos(bills);
                        result = ((IBatchRunScript) NCLocator.getInstance()
                                        .lookup(IBatchRunScript.class)).runBacth(context, AggAmortizationVO.class);
                        
                } catch (Exception var4) {
                        ExceptionUtils.wrapException(var4);
                }

                return result;
        }

        @Override
        public Class<AggAmortizationVO> getClazz() {
                return AggAmortizationVO.class;
        }
        
}
